<html>
<head>
<title>JSON-RPC Tester</title>
<script src="./jquery.js"></script>
<script type="text/javascript">
		idx = 1;
	
		function doAjaxRequest(m, parameters, target) {		
			var tmpObject = {jsonrpc: 2.0, method: m, params: parameters, id: idx++};
			var string = JSON.stringify(tmpObject);
			$.post("http://localhost:8080",string,function(data) {
				var response = JSON.parse(data);
				$(target).html(response.result);
			});
		}
</script>
</head>

<body>

<h1>Testing JSON-RPC Server</h1>
<form id="testform"><label>Enter your name:</label> 
	<input type="text" id="thename" /></form>
<p id="result">Result will be displayed here...</p>
</body>
</html>
<script>
$("#testform").submit(function() {
	doAjaxRequest('sayHello',{name:$("#thename").val()},"#result");
	return false;
});
</script>